package com.grf.scala

/**
  * 隐式转换
  */
object Implicit {
  def main(args: Array[String]): Unit = {
    //隐式转换的方法
    implicit def f1(d: Double): Int = {
      d.toInt
    }
    val num: Int = 3.5
    val num1: Int = 6.7
    //println(num)
    implicit def change(a1:A):B ={
      new B
    }
    val a2 = new A
    a2.b()
  }
}
class A{
  def a(): Unit ={
    println("a")
  }
}
class B{
  def b(): Unit ={
    println("b")
  }

}
